<?php

use Illuminate\Support\Facades\Route;

Route::get('/',[\App\Http\Controllers\BaseController::class,'home'])->name('home');

Route::get('/help', [\App\Http\Controllers\BaseController::class,'help'])->name('help');

Route::get('/about', [\App\Http\Controllers\BaseController::class,'about'])->name('about');

//用户相关路由

//用户注册
Route::get('/register', [\App\Http\Controllers\UsersController::class,'create'])->name('user.create');
//用户资源路由
Route::resource('users', \App\Http\Controllers\UsersController::class);
//用户登录和退出登录
Route::get('login', [\App\Http\Controllers\AuthController::class,'loginWeb'])->name('login');
Route::post('login', [\App\Http\Controllers\AuthController::class,'loginOpt'])->name('login');
Route::delete('logout', [\App\Http\Controllers\AuthController::class,'logout'])->name('logout');
//激活账号的路由
Route::get('account/active/{token}',[\App\Http\Controllers\UsersController::class,'accountActive'])->name('account.active');

//重置密码，输入邮箱页面
Route::get('repassword/email/web',[\App\Http\Controllers\PasswordController::class,'repasswordEmailWeb'])->name('repassword.email.web');
//用户重置密码点击的URL
Route::get('repassword/url/{token}',[\App\Http\Controllers\PasswordController::class,'repasswordUrl'])->name('repassword.url');
//发送邮件到目标邮箱
Route::post('repassword/send/email',[\App\Http\Controllers\PasswordController::class,'repasswordSendEmail'])->name('repassword.send.email');
//密码重置
Route::post('password/reset',[\App\Http\Controllers\PasswordController::class,'passwordReset'])->name('password.reset');

//文章的资源路由
Route::resource('post',\App\Http\Controllers\PostController::class);

//关注和粉丝路由
Route::get('users/{user}/fans',[\App\Http\Controllers\UsersController::class,'getFans'])->name('users.fans');
Route::get('users/{user}/fanings',[\App\Http\Controllers\UsersController::class,'getFanings'])->name('users.fanings');

//关注和取消关注
Route::post('user/fan/{user}',[\App\Http\Controllers\FansController::class,'fanUser'])->name('fan.user');
Route::delete('user/unfan/{user}',[\App\Http\Controllers\FansController::class,'unfanUser'])->name('unfan.user');
